<?php
require_once('sub.inc.php');

if(is_null($_POST['url']) || is_null($_POST['domain'])){
	print "require url";
}else{

	$domain = $_POST['domain'];
	$res3 = mysqli_query($GLOBALS['con'], "SELECT `tld` from `domains` WHERE `id`='$domain' LIMIT 0,1");
	if( $row3 = mysqli_fetch_array($res3) ){
		$outdomain = $row3['tld'];
	}else{
		exit("Invalid Domain ID");
	}

	$result = createURL($_POST['url'], 5, $domain);
	print "http://".$outdomain."/".$result;
}
